package tech.aistar.corejava.day12.homework.home04;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;

/**
 * @Author: lya
 * @Description: 本类的作用描述:
 * @CreateDate: 2019/7/31
 * @Version: 1.0
 */
public class Test {
    public static void main(String[] args) {
        HashSet<Product> hashSet = new HashSet<>();

        List<Product> list = new ArrayList<>();

        hashSet.add(new Product(1,"洗手粉1",218.5,"中国"));
        hashSet.add(new Product(2,"洗手粉2",118.5,"中国"));
        hashSet.add(new Product(3,"洗手粉3",318.5,"中国"));
        hashSet.add(new Product(1,"洗手粉1",518.5,"中国"));
        hashSet.add(new Product(4,"洗手粉4",418.5,"中国"));

        Iterator<Product> iter = hashSet.iterator();
        while(iter.hasNext()){
            Product p = iter.next();
            System.out.println(p);
            if (p.getPrice() > 300){
                list.add(p);
            }
        }
        System.out.println("================");
        System.out.println(list);

    }

}
